package org.wmq.positiontoshop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.wmq.positiontoshop.mapper.UserMapper;
import org.wmq.positiontoshop.model.DO.User;
import org.wmq.positiontoshop.service.UserService;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Override
    public long countByNameAndPassword(String username, String password) {
        return this.lambdaQuery().eq(User::getName, username).eq(User::getPassword, password).count();
    }

    @Override
    public User getByNameAndPassword(String username, String password) {
        return this.lambdaQuery().eq(User::getName, username).eq(User::getPassword, password).one();
    }

    @Override
    public long countByName(String username) {
        return this.lambdaQuery().eq(User::getName, username).count();
    }
}
